package com.cuiweiyou.bluemesh.util;

import android.util.Log;

public class RssiUtil {

    private static double a = 65d; // 与蓝牙设备相隔一米时的信号强度
    private static double n = 2d; // 环境衰减因子

    private RssiUtil() {
    }

    /**
     * 信号转距离
     *
     * @param rssi 信号强度
     * @return 拟合得到的估计距离
     */
    public static double rssiToMile(int rssi) {
        double diff = Math.pow(10d, (Math.abs(rssi) - a) / (10d * n));
        return diff;
    }
}
